import http from "@/api";
// 定义响应数据的接口
interface ApiResponse {
  code: number;
  msg: string;
  data?: any; // 如果有其他数据字段，可以在这里定义
}

// 获取apiToken

export const Apitoken = (): Promise<AxiosResponse> => {
  return http({
    url: "/dapp/api/getApiToken",
    method: "get",
  });
};

//提币

export const Withdrawal = (data, headers): Promise<AxiosResponse> => {
  return http({
    url: "/dapp/user/withdrawal",
    method: "post",
    data,
    headers: headers,
  });
};

// 转账 （提现，提到其他钱包）
export const WithTransfer = (data, headers): Promise<AxiosResponse> => {
  return http({
    url: "/dapp/user/transfer",
    method: "post",
    data,
    headers: headers,
  });
};
//充值回调

export const Recharge = (data): Promise<AxiosResponse> => {
  return http({
    url: "/dapp/user/recharge",
    method: "post",
    data,
  });
};

//充值预下单

export const PreRecharge = (data, headers): Promise<AxiosResponse> => {
  return http({
    url: "/dapp/user/preRecharge",
    method: "post",
    data,
    headers: headers,
  });
};

//购买算力
export const BuyPower = (data, headers): Promise<AxiosResponse> => {
  return http({
    url: "/dapp/user/buyPower",
    method: "post",
    data,
    headers: headers,
  });
};
